#include <bits/stdc++.h>

#define in read()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;

const int mod = 998244353;

ll n, m, X;
unordered_map < ll, int > tans;

int sd(ll x) {
	if(x < 0) return 0; if(tans.count(x)) return tans[x];
	ll tot = 0;
	for(ll l = 1, r; l <= x; l = r + 1) {
		r = x / (x / l);
		tot += (r - l + 1) * (x / l) % mod; tot %= mod;
	} /* cerr << tot << endl; */return tans[x] = tot;
}

int calc(ll x, ll y, int lx, int ly) {
	if(lx > ly) swap(lx, ly), swap(x, y);
	ll l = (x ^ y ^ X) & (~((1ll << ly) - 1)), r = l + (1ll << ly) - 1;
	return 1ll * (sd(r) - sd(l - 1) + mod) % mod * (1ll << lx) % mod;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
	cin >> n >> m >> X; n++; m++;
	int ans = 0;
	rep(i, 0, 50) if(n >> i & 1ll) rep(j, 0, 50) if(m >> j & 1ll) (ans += calc(n ^ 1ll << i, m ^ 1ll << j, i, j)) %= mod;
	cout << ans << endl;
	return 0;
}
